package com.cloudkinto.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 * @author hua
 * @since 2024-11-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_warehouse_rent_detail")
public class WarehouseRentDetailDo extends Model<WarehouseRentDetailDo> {

    private static final long serialVersionUID=1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("rent_id")
    private Long rentId;

    /**
     * 开始库龄 其他传0
     */
    @TableField("start_age")
    private Integer startAge;

    /**
     * 结束库龄 其他传0
     */
    @TableField("end_age")
    private Integer endAge;

    /**
     * 1月
     */
    @TableField("january")
    private Double january;

    /**
     * 2月
     */
    @TableField("february")
    private Double february;

    /**
     * 4月
     */
    @TableField("april")
    private Double april;

    /**
     * 5月
     */
    @TableField("may")
    private Double may;

    /**
     * 6月
     */
    @TableField("june")
    private Double june;

    /**
     * 7月
     */
    @TableField("july")
    private Double july;

    /**
     * 8月
     */
    @TableField("august")
    private Double august;

    /**
     * 9月
     */
    @TableField("september")
    private Double september;

    /**
     * 10月
     */
    @TableField("october")
    private Double october;

    /**
     * 11月
     */
    @TableField("november")
    private Double november;

    /**
     * 12月
     */
    @TableField("december")
    private Double december;

    /**
     * 3月
     */
    @TableField("march")
    private Double march;

    @TableField(value = "delete_flag", fill = FieldFill.INSERT)
    @TableLogic
    private Integer deleteFlag;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private Long createBy;

    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private Date updateTime;

    @TableField(value = "update_by", fill = FieldFill.UPDATE)
    private Long updateBy;

    @TableField("delete_time")
    private Date deleteTime;

    @TableField("delete_by")
    private Long deleteBy;

    public Double getRentFee(int month) {
        switch (month){
            case 1 :
                return january;
            case 2:
                return february;
            case 3:
                return march;
            case 4:
                return april;
            case 5:
                return may;
            case 6:
                return june;
            case 7:
                return july;
            case 8:
                return august;
            case 9:
                return september;
            case 10:
                return october;
            case 11:
                return november;
            case 12:
                return december;
            default:
                return 1d;
        }
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
